import 'package:flutter/material.dart';

import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:flutterapp/config/ImagesConfig.dart';

class SwiperPage extends StatelessWidget {
  SwiperPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        body: new Swiper(
      itemBuilder: (BuildContext context, int index) {
        return new Image.asset(
          welcomeImages[index],
          fit: BoxFit.fill,
        );
      },
      autoplay: false,
      // autoplayDelay: 2000,
      itemCount: welcomeImages.length,
      pagination: new SwiperPagination(),
      onIndexChanged: (int index) {
        if (index == 2) {
          Future.delayed(Duration(milliseconds: 2000), () {
            Navigator.pushNamed(context, '/tabs');
          });
        }
      },
    ));
  }
}
